package com.fm.app03.Activity;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.DatePicker;
import android.widget.EditText;

import com.fm.app03.R;

public class starActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_star);

        Button button = findViewById(R.id.Constellation_button);
        button.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                // 获取姓名
                EditText editText = findViewById(R.id.editText_name);
                String name = editText.getText().toString();

                // 获取日期
                DatePicker datePicker = findViewById(R.id.datePicker);
                int year = datePicker.getYear();
                int month = datePicker.getMonth();
                int day = datePicker.getDayOfMonth();

                // 创建Intent对象并附加数据
                Intent intent = new Intent(starActivity.this, StarDetailsActivity.class);
                intent.putExtra("name", name);
                intent.putExtra("year", year);
                intent.putExtra("month", month);
                intent.putExtra("day", day);

                // 启动另一个活动
                startActivity(intent);
            }
        });



    }


}